package com.zynn.feign.module.es;

import com.zynn.common.pojo.dto.EventDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author jerry-liqi
 *
 * <p>
 * 事件
 */
@FeignClient(value = "service-module-es")
public interface EventsFeignService {

    @GetMapping("/event/get/events")
    List<EventDTO> getEvents(@RequestParam(value = "userId", required = false) Long userId, @RequestParam(value = "groupIds", required = false) String groupIds, @RequestParam(value = "eventTypes", required = false) String eventTypes, @RequestParam(value = "lastEventId", required = false) Long lastEventId, @RequestParam(value = "pageSize", required = false) Long pageSize, @RequestParam(value = "isAsc", required = false) Boolean isAsc, @RequestParam(value = "useLimit", required = false) Boolean useLimit);


    /**
     * 查询用户当天的动态
     *
     * @param userId
     * @param createTime
     * @return
     */
    @GetMapping("/event/group/users")
    List<EventDTO> getUserCurrentDayEvents(@RequestParam("userId") Long userId, @RequestParam("createTime") String createTime);

    /**
     * 查询某一个动态
     *
     * @param eventId
     * @return
     */
    @GetMapping("/event/get/event")
    EventDTO getEvent(@RequestParam(value = "eventId") Long eventId);


    /**
     * 查询用户相册内的动态
     *
     * @param userId
     * @param groupId
     * @param lastEventId
     * @param useLimit
     * @return
     */
    @GetMapping("/event/by/user")
    List<EventDTO> queryEventByUser(@RequestParam("userId") Long userId, @RequestParam(value = "groupId", required = false) Long groupId, @RequestParam(value = "lastEventId", required = false) Long lastEventId, @RequestParam("useLimit") boolean useLimit);

    /**
     * 动态点赞排行（动态）
     *
     * @param groupId
     * @param limit
     * @return
     */
    @GetMapping("/event/like/sort")
    List<EventDTO> getEventsByLikeSort(@RequestParam("groupId") Long groupId, @RequestParam("limit") Integer limit);

    /**
     * 照片数排行（用户）
     *
     * @param groupId
     * @param limit
     * @return
     */
    @GetMapping("/event/resource/sort")
    List<Map<String, Object>> getEventsByResourceSort(@RequestParam("groupId") Long groupId, @RequestParam("limit") Integer limit);
}
